home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 47215 / 47215.xpi / chrome / content / lib / tabs.js < prev    next >
Text File  |  2009-11-22  |  1KB  |  41 lines

  1. (function()
  2. {
  3.     //returns the tab context menu
  4.     this.tabContextMenu = function()
  5.     {
  6.         if(!this.getBrowserElement('tabContextMenu'))
  7.             return document.getAnonymousElementByAttribute(this.getBrowserElement("content") , "anonid", "tabContextMenu");
  8.         else
  9.             return this.getBrowserElement('tabContextMenu');
  10.     }
  11.     //returns a count of tabs 
  12.     this.tabCount = function()
  13.     {
  14.         return gBrowser.tabContainer.childNodes.length;
  15.     }
  16.     //returns a tab from a document-REVIEW
  17.     /*
  18.         http://forums.mozillazine.org/viewtopic.php?p=3329527#p3329527
  19.         document of page = event.originalTarget
  20.         window of page = event.originalTarget.defaultView
  21.         browser = gBrowser.getBrowserForDocument(event.originalTarget)
  22.         tab = gBrowser.mTabs[gBrowser.getBrowserIndexForDocument(event.originalTarget)]
  23.         panel = gBrowser.mTabs[gBrowser.getBrowserIndexForDocument(event.originalTarget)].linkedPanel
  24.     */
  25.     this.tabGetFromDocument = function(aDoc)
  26.     {
  27.         return gBrowser.mTabs[gBrowser.getBrowserIndexForDocument(aDoc)]
  28.     }
  29.     //gets the current URI from aTab-REVIEW
  30.     this.tabGetLocation = function(aTab)
  31.     {
  32.         if(aTab.hasAttribute('permaTabUrl'))
  33.             return String(aTab.getAttribute('permaTabUrl'));
  34.         else
  35.             return String(this.browserGetFromTab(aTab).currentURI.spec);
  36.     }
  37.  
  38.     return null;
  39.  
  40. }).apply(URLtoTabTitle);
  41.